<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::create('temp_verification_codes', function (Blueprint $table) {
            $table->id();
            $table->string('email')->comment('邮箱地址');
            $table->string('code', 6)->comment('验证码');
            $table->string('type')->comment('验证码类型');
            $table->timestamp('expired_at')->comment('过期时间');
            $table->timestamps();

            // 索引
            $table->index('email');
            $table->index('code');
            $table->index('expired_at');

            $table->comment('临时验证码表');
        });
    }

    public function down()
    {
        Schema::dropIfExists('temp_verification_codes');
    }
}; 